/*
*
==============================================================================
*  Name        : 
*  Part of     : Omen Game Engine
*  Description : 
*  Version     : 1.0
*
*  Copyright (c) 2013 Lauri Kortevaara.
* 
==============================================================================
*/

#define OMEN_SOURCE 1

#include "OmenDataTypes.h"

__declspec(dllexport) Omen_GUID OMEN_UUID( const char str[] )
{
    Omen_GUID guid;
    memcpy( &guid, str, strlen((char*)str) );
    return guid;
}

__declspec(dllexport) Omen_GUID newUUID()
{
    Omen_GUID guid;
#ifdef WIN32
    UUID uuid;
    UuidCreate ( &uuid );

    unsigned char * str;
    UuidToStringA ( &uuid, &str );

    memcpy( &guid, str, strlen((char*)str) );
    guid.Data[36] = '\0';

    RpcStringFreeA ( &str );
#else
    uuid_t uuid;
    uuid_generate_random ( uuid );
    char s[37];
    uuid_unparse ( uuid, s );
    memcpy( &guid, s, strlen((WCHAR*)s) );
#endif
    return guid;
}
/// EOF